home *** CD-ROM | disk | FTP | other *** search
- Path: god.bel.alcatel.be!nlev00!barnhoorn
- From: barnhoorn@nlev00 ()
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Removing Processes
- Date: 25 Mar 1996 12:07:03 GMT
- Organization: Alcatel Bell
- Distribution: world
- Message-ID: <4j6297$efa@btmpjg.god.bel.alcatel.be>
- References: <84215-826944629@mindlink.bc.ca> <314E576C.4E36@sapiens.com>
- Reply-To: barnhoorn@nlev00 ()
- NNTP-Posting-Host: 138.203.178.61
- X-Newsreader: mxrn 6.18-10
-
-
- In article <314E576C.4E36@sapiens.com>, Avi Lev <avil@sapiens.com> writes:
- >Dave Thomas wrote:
- >>
- >> Hi! I'm writing a program which spawns a sub-process to do another task
- >> while the main program handles input. The problem I'm finding is that the
- >> sub-process doesn't exit reliably. Sometimes it appears to exit, and
- >> sometimes not. Currently, I am allowing the subprocess to run to the end,
- >> when (I assume) it does an "RTS" and returns to the OS for removal. Should
- >> I be using "RemTask()" to remove the sub-process? And, if so, should it be
- >> called from the sub-process, or from the main program? BTW, the
- >> sub-process is a procedure in the program, and uses some global variables
- >> and string constants.
- >
- >NO!!! RemTask() removes tasks not processes. how do you know if the sub-process actually finished, it
- >might be suspended cuz of higher priority process. i think there's a wait() function which checks to
- >see if the process finished and if not it waits until it does, you might want to go in that direction
- >first. what you're describing sounds like it's a task NOT a real AmigaDos process cuz the 'process'
- >sits in your own program, if that's the case then it's a task not a process and then you can use
- >RemTask() from the creator of the task.
-
- ## AAAHHH wrong wrong wrong wrong.
- You may either run parts of your application as a process or as a task.
- For running a part of your application as a process, use CreateNewProc().
- For running a part of your application as a task, use CreateTask().
- I suggest you always use CreateNewProc().
- When you use one of the two mentioned functions, your subtask or process
- will exit reliably - if they don't, you probably have a bug in your code.
- You should not exit the main process as long as one of your subprocesses
- or tasks are running (obviously...).
- You may only remove subtasks (or processes?) as long as it is not
- calling any amiga-library-function (because these might be sending messages,
- waiting for signals, using other stacks, etcetera).
- There is no Wait() function with which you can wait for a process or task
- to complete.
-
- >>
- >> Next question: I am using a process because I am writing a NNTP news reader
- >> program, and I want the sub-process to do the communication across the 'net
- >> (using AmiTCP). It's not clear to me that a task would be sufficient to do
- >> this. Would it be?
- >>
- >
- >Again NO!!! Tasks are very limited in their capabilities, they can't use DOS services i believe, but
- >if you're not using any i guess a task would suffice.
- >
-
- ## That is true, tasks can not use in any way the dos.library, nor can they
- call any amiga-library-function that might call dos.library (e.g. OpenDiskFont).
- Therefor, I suggest you to create a process always, using CreateNewProc().
-
-
- --
- ---------------------------------------------------------------------------
- Jaco Barnhoorn barnie@xs4all.nl
- Software Test Engineer barnhoorn%nlev00@btmv56.se.bel.alcatel.be
- Alcatel Telecom Systems
- Rijswijk, The Netherlands
- ---------------------------------------------------------------------------
-